home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 January / Macworld (1997-01).dmg / Shareware World / Utilities / Data & Time Management / MacCalendar / Src / MacCalendar.h < prev    next >
Text File  |  1994-10-20  |  4KB  |  122 lines

  1. /*                                    MacCalendar.h                                    */
  2. /*
  3.  * MacCalendar.h
  4.  * Copyright © 1993-94 Apple Computer Inc. All rights reserved.
  5.  *
  6.  * Edit History:
  7.  *    1.0d0    MM    First "public" distribution.
  8.  *    1.0d1    MM    Added the setup application.
  9.  *    1.0d2    MM    Added balloon help to the setup dialog. Added a "can't
  10.  *                find preference file alert." No substantive changes.
  11.  *    1.0d3    MM    Some small fixes from the Status Bar author. Now hiliting
  12.  *                the days of the week and today's date if shown.
  13.  *    1.0d4    MM    Revised to use the current ControlStrip header file. Removed
  14.  *                references to a local copy of Icons.h as the Universal Header
  15.  *                distribution has this information. Shrunk next/last month buttons.
  16.  *                Make a copy of the intlHdl so we don't change the system info.
  17.  *    1.0d5    MM    Bug displaying October 1994 - blank first line.
  18.  *    1.0d6    MM    Redid drawing routine.
  19.  *    1.0d7    FM    Changed GetDisplayRect so the calendar does not split between
  20.  *                two screens. Changed the routine to better match menu behavior.
  21.  *                Redid the rightArrowPict so it matches the standard Control
  22.  *                Strip shape. Stored the first day of the week into the preferences
  23.  *                record (dumb bug). Also, checked that the first day of the week
  24.  *                is either Sunday or Monday.
  25.  */
  26. #define kApplicationCreator    'SCAL'
  27. #define ICON_Calendar        128
  28. #define ICON_StatusBar        256
  29. #define FREF_Calendar        128
  30. #define BNDL_Calendar        128
  31. #define STRN_Info            256
  32. #define PICT_RightArrow        128
  33. #define    kIconWidth            16
  34. #define kVersionMajor        1
  35. #define kVersionMinor        0
  36. #define kVersionStage        development
  37. #define kVersionRelease        7
  38. #define kVersionIdent        "1.0d7"
  39. #define kVersionString        "1.0d7 © 1993-94 Apple Computer Inc."
  40. #define kCalendarPrefName    "MacCalendar Preferences"    /* No \p */
  41. #define kFirstIsSunday        1
  42. #define kFirstIsMonday        2
  43. #ifndef REZ
  44. #ifndef FALSE
  45. #define FALSE                0
  46. #define TRUE                1
  47. #endif
  48.  
  49. /*
  50.  * This is saved across restarts - it is set from "factory settings" if no
  51.  * preference resource is found in the Status Bar preference file, and can
  52.  * be changed by the MacCalendarSetup application.
  53.  */
  54. typedef struct SavedSettings {
  55.     OSType            signature;                    /* Our signature                    */
  56.     OSType            prefVersion;                /* Preference revision level        */                
  57.     Str255            dateString;                    /* Current date label string        */
  58.     Str255            fontName;                    /* Requested display font            */
  59.     short            fontSize;                    /* Display font size                */
  60.     short            firstDayOfWeek;                /* Sunday == 1                        */
  61. } SavedSettings, **SavedSettingsHandle;
  62.  
  63. /*
  64.  * The value of kPrefVersion has no special significance. It should be changed
  65.  * whenever the SavedSettings resource is changed, or whenever it you desire to
  66.  * redefine the SavedSettings resource (for example, during debugging).
  67.  */
  68. #define kPrefVersion        ('1004')            /* Change this to rebuild pref's    */
  69. enum {
  70.     kStringPreference = 1,
  71.     kStringHelp,
  72.     kStringFontName,
  73.     kStringFontSize,
  74.     kStringFirstDayOfWeek,
  75.     kStringDayNames
  76. };
  77.  
  78. enum {
  79.     kMsgReadingPrefResource,
  80.     kMsgWritingPrefResource,
  81.     kMsgSystemError
  82. };
  83.     
  84. /*
  85.  * These functions are defined in DrawCalendar.c. They are not specific to
  86.  * the Status Bar module interface.
  87.  */
  88. /*
  89.  * DrawCalendar draws the current calendar in the current port in the specified
  90.  * display area.
  91.  */
  92. void                        DrawCalendar(
  93.         short                    year,            /* 1904 ..                    */
  94.         short                    month,            /* January == 1                */
  95.         short                    firstDayOfWeek,    /* Sunday = 1, Monday 2        */
  96.         const unsigned char        *dayName,        /* Day of week string        */
  97.         const Rect                *displayRect,    /* Where to draw the text    */
  98.         short                    fontNumber,        /* Display font                */
  99.         short                    fontSize        /* Display font size        */
  100.     );
  101. /*
  102.  * GetCalendarDisplaySize returns the size of the calendar if it is to be drawn
  103.  * in the specified fontNumber and fontSize.
  104.  */
  105. Point                        GetCalendarDisplaySize(
  106.         short                    fontNumber,        /* Display font                */
  107.         short                    fontSize        /* Display font size        */
  108.     );
  109. /*
  110.  * GetCalendarMonthRect uses the fontNumber and fontSize to compute the size
  111.  * size of the calendar as it will be drawn. Then the function creates an
  112.  * actual display rectangle that is centered in the specified displayRect.
  113.  */
  114. void                        GetCalendarMonthRect(
  115.         short                    fontNumber,        /* Display font                */
  116.         short                    fontSize,        /* Display font size        */
  117.         const Rect                *displayRect,    /* Where to draw the text    */
  118.         Rect                    *monthRect        /* Returns drawing rect        */
  119.     );
  120. #endif /* REZ */
  121.  
  122.